/**
 * This class is the main view for the application. It is specified in app.js as the
 * "autoCreateViewport" property. That setting automatically applies the "viewport"
 * plugin to promote that instance of this class to the body element.
 *
 * TODO - Replace this content of this view to suite the needs of your application.
 */
Ext.define('tPAXXAdminDesktop.view.main.Main', {
    extend: 'Ext.ux.desktop.App',
    requires: [
        'tPAXXAdminDesktop.view.main.MainController',
        'Ext.window.MessageBox',
        'Ext.ux.desktop.ShortcutModel'
    ],
    xtype: 'app-main',
    controller: 'main',
    viewModel: {
        type: 'main'
    },
    layout: {
        type: 'border'
    },
    modules: [],
    dConfigs: [],
    tbConfigs: [],
    getDesktopConfig: function () {
        var me = this, ret = me.callParent();

        return Ext.apply(ret, {
            contextMenuItems: [
                { text: 'Change Settings', handler: me.onSettings, scope: me }
            ],

            shortcuts: Ext.create('Ext.data.Store', {
                model: 'Ext.ux.desktop.ShortcutModel',
                data: me.dConfigs
            }),

            wallpaper: 'resources/images/wallpapers/desk.jpg',
            wallpaperStretch: true
        });
    },

    getModules: function() {
        return this.modules;
    },

    // config for the start menu
    getStartConfig : function() {
        var me = this, ret = me.callParent();

        return Ext.apply(ret, {
            title: 'Administrator',
            iconCls: 'fa fa-user',
            height: 300,
            toolConfig: {
                width: 100,
                items: [
                    {
                        text:'Settings',
                        iconCls:'fa fa-cog',
                        handler: me.onSettings,
                        scope: me
                    },
                    '-',
                    {
                        text:'Logout',
                        iconCls:'fa fa-key',
                        handler: me.onLogout,
                        scope: me
                    }
                ]
            }
        });
    },

    getTaskbarConfig: function () {
        var ret = this.callParent();

        return Ext.apply(ret, {
            iconCls: 'fa fa-cogs',
            startBtnText: 'tPAXX',
//            quickStart: [
//                { name: 'Accordion Window', iconCls: 'accordion', module: 'acc-win' },
//                { name: 'Grid Window', iconCls: 'icon-grid', module: 'grid-win' }
//            ],
            trayItems: [
                { xtype: 'trayclock', flex: 1 }
            ]
        });
    },

    onSettings: function () {
        var dlg = Ext.create('tPAXXAdminDesktop.view.main.Settings', {
            desktop: this.desktop
        });
        dlg.show();
    }
});
